package com.example.myapplication;

import java.net.Inet4Address;
import java.util.Map;
import java.util.Optional;

import pojo.PLD_daemon;
import pojo.Timed;

public class ScanEntry {
    Inet4Address address;
    PLD_daemon daemon;
    Map<String, Timed> list;

    String position;

    public ScanEntry(Inet4Address address, PLD_daemon daemon, Map<String, Timed> list) {
        this.address = address;
        this.daemon = daemon;
        this.list = list;
    }

    public Inet4Address getAddress() {
        return address;
    }

    public PLD_daemon getDaemon() {
        return daemon;
    }

    public Map<String, Timed> getList() {
        return list;
    }

    @Override
    public String toString() {
        return Optional.ofNullable(daemon).map(d -> d.getTitle() + " " + d.getCode()).orElse("no daemon") + " on " + address;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }
}
